/*    */ package com.lmpop.frame.util;
/*    */ 
/*    */ import java.security.MessageDigest;
/*    */ 
/*    */ public class MD5
/*    */ {
/*    */   public String getMD5(byte[] source)
/*    */   {
/*  4 */     String s = null;
/*  5 */     char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
/*    */     try {
/*  7 */       MessageDigest md = MessageDigest.getInstance("MD5");
/*  8 */       md.update(source);
/*  9 */       byte[] tmp = md.digest();
/*    */ 
/* 11 */       char[] str = new char[32];
/*    */ 
/* 13 */       int k = 0;
/* 14 */       for (int i = 0; i < 16; i++)
/*    */       {
/* 16 */         byte byte0 = tmp[i];
/* 17 */         str[(k++)] = hexDigits[(byte0 >>> 4 & 0xF)];
/*    */ 
/* 19 */         str[(k++)] = hexDigits[(byte0 & 0xF)];
/*    */       }
/* 21 */       s = new String(str);
/*    */     }
/*    */     catch (Exception e) {
/* 24 */       e.printStackTrace();
/*    */     }
/* 26 */     return s;
/*    */   }
/*    */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.frame.util.MD5
 * JD-Core Version:    0.6.0
 */